package mall.dao;

import mall.pojo.Membertype;

import org.hibernate.Query;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class MemberTypeDAOImpl implements MemberTypeDAO {

	@Autowired
	private SessionFactory sessionFactory;
	
	@Override
	public Membertype getMemberType(int typeId) {
		String hql="FROM Membertype MT WHERE MT.id="+typeId;
		Query query= sessionFactory.getCurrentSession().createQuery(hql);
		return (Membertype)query.list().get(0);
	}
	

}
